package cn.iocoder.yudao.module.promotion.dal.mysql.shortlinkgeneratee;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.promotion.controller.admin.shortlinkgeneratee.vo.ShortLinkGenerateeExportReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.shortlinkgeneratee.vo.ShortLinkGenerateePageReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.shortlinkgeneratee.ShortLinkGenerateeDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 短链接生成 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface ShortLinkGenerateeMapper extends BaseMapperX<ShortLinkGenerateeDO> {

    default PageResult<ShortLinkGenerateeDO> selectPage(ShortLinkGenerateePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShortLinkGenerateeDO>()
                .likeIfPresent(ShortLinkGenerateeDO::getName, reqVO.getName())
                .eqIfPresent(ShortLinkGenerateeDO::getShortDomainId, reqVO.getShortDomainId())
                .eqIfPresent(ShortLinkGenerateeDO::getShortDomain, reqVO.getShortDomain())
                .eqIfPresent(ShortLinkGenerateeDO::getLongUrlId, reqVO.getLongUrlId())
                .eqIfPresent(ShortLinkGenerateeDO::getLongUrl, reqVO.getLongUrl())
                .eqIfPresent(ShortLinkGenerateeDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ShortLinkGenerateeDO::getCreateTime, reqVO.getCreateTime())
                .ne(ShortLinkGenerateeDO::getName, "未下单提醒[系统创建]")
                .orderByDesc(ShortLinkGenerateeDO::getId));
    }

    default List<ShortLinkGenerateeDO> selectList(ShortLinkGenerateeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShortLinkGenerateeDO>()
                .likeIfPresent(ShortLinkGenerateeDO::getName, reqVO.getName())
                .eqIfPresent(ShortLinkGenerateeDO::getShortDomainId, reqVO.getShortDomainId())
                .eqIfPresent(ShortLinkGenerateeDO::getShortDomain, reqVO.getShortDomain())
                .eqIfPresent(ShortLinkGenerateeDO::getLongUrlId, reqVO.getLongUrlId())
                .eqIfPresent(ShortLinkGenerateeDO::getLongUrl, reqVO.getLongUrl())
                .eqIfPresent(ShortLinkGenerateeDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ShortLinkGenerateeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShortLinkGenerateeDO::getId));
    }

    default List<ShortLinkGenerateeDO> selectList(ShortLinkGenerateePageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShortLinkGenerateeDO>()
                .likeIfPresent(ShortLinkGenerateeDO::getName, reqVO.getName())
                .eqIfPresent(ShortLinkGenerateeDO::getShortDomainId, reqVO.getShortDomainId())
                .eqIfPresent(ShortLinkGenerateeDO::getShortDomain, reqVO.getShortDomain())
                .eqIfPresent(ShortLinkGenerateeDO::getLongUrlId, reqVO.getLongUrlId())
                .eqIfPresent(ShortLinkGenerateeDO::getLongUrl, reqVO.getLongUrl())
                .eqIfPresent(ShortLinkGenerateeDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ShortLinkGenerateeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShortLinkGenerateeDO::getId));
    }
}
